<?php
$params = array_merge(
    require BASE_PATH . '/config/params.php',
    require BASE_PATH . '/config/params-local.php'
);
defined('APPLICATION_ID') or define('APPLICATION_ID', 'client');

return [
    'id' => APPLICATION_ID,
    'controllerNamespace' => 'apps\client\controllers',
    'bootstrap' => ['log'],
    'modules' => Heihei::$modules,
    'runtimePath' => BASE_PATH . DIRECTORY_SEPARATOR . 'runtime' . DIRECTORY_SEPARATOR . APPLICATION_ID,
    'components' => [
        'request' => [
            'class' => 'heihei\rest\Request',
            'csrfParam' => '_csrf-' . APPLICATION_ID,
            'parsers' => [
                'application/json' => 'yii\web\JsonParser',
                'text/json' => 'yii\web\JsonParser',
            ]
        ],
        'user' => [
            'identityClass' => 'apps\client\models\User',
            'enableSession' => true,
            'loginUrl' => null
        ],
        'session' => [
            // this is the name of the session cookie used for login on the manage
            'class' => 'heihei\web\RestSession',
            'name' => 'client-access-token',
            'useTransparentSessionID' => 1,
            'useCookies' => false
        ],
        'authManager' => [
            'class' => 'heihei\rbac\AuthManager',
            'allowPermissions' => ['site/error','site/login']
        ],
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
                'login' => 'passport/login',
                'forget' => 'passport/forget',
                'logout' => 'passport/logout'
            ],
        ]
    ],
    'params' => $params,
];
